This provides a huge speedup as we only need to preprocess style
properties when they are indeed inherited. This roughly doubles the
performance of the CSS matcher and brings the time taken by
gtk_css_provider_get_style() from 19% to 7% in my favorite benchmark.
GtkCssSelector *selector;
GHashTable *widget_style;
GHashTable *style;
+
+ guint has_inherit :1;
};
struct _GtkCssScanner
NULL,
(GDestroyNotify) property_value_free);
+ ruleset->has_inherit |= gtk_style_param_get_inherit (pspec);
g_hash_table_insert (ruleset->style, pspec, value);
}
if (ruleset->style == NULL)
continue;
- if (l < length && _gtk_css_selector_get_state_flags (ruleset->selector))
+ if (l < length && (!ruleset->has_inherit || _gtk_css_selector_get_state_flags (ruleset->selector)))
continue;
if (!gtk_css_ruleset_matches (ruleset, path, l))